package com.exam;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class MyCallable implements Callable<Integer> {

    public static final Logger logger = LoggerFactory.getLogger("MyCallable");
    public static void main(String[] args) {
        logger.info("这里是测试");
        Callable<Integer> callable = new MyCallable();
        FutureTask<Integer> futureTask = new FutureTask<>(new MyCallable());
        Thread thread = new Thread(futureTask);
        thread.setName("2");
        thread.start();
        try{
            System.out.println(futureTask.get());
        }
        catch (Exception e){
            System.out.println(e.getCause());
        }
        Thread nowThread = Thread.currentThread();
        System.out.println(thread.getName());

    }

    @Override
    public Integer call() throws Exception {
        System.out.println("Call线程执行");
        return 1;
    }
}
